package com.servlet.request1; /**
 * @author wzm
 * @create 2023-11-06 11:26
 * project_name:web2310
 * @Description
 */

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/win2")
public class Win2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        doPost(request, response);//调用doPost
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("你好，窗口2很高兴为你服务，请出示小票");

        //删除
        request.removeAttribute("piao");
        //修改
       // request.setAttribute("piao", "小票内容");;

        //获取request中携带的数据
        Object piao = request.getAttribute("piao");

        System.out.println("小票内容 = " + piao);

    }
}
